package pl.edu.agh.mguesser.ui.game;

import java.awt.BorderLayout;
import javax.annotation.PostConstruct;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.springframework.stereotype.Controller;
import pl.edu.agh.mguesser.game.listener.GameStartedListener;
import pl.edu.agh.mguesser.game.listener.NewRoundListener;

/**
 * @author keiran
 */
@Controller
public class RoundPanel extends JPanel implements GameStartedListener,
                                                  NewRoundListener {

    private JTextField currentRoundField;
    
    @PostConstruct
    public void postConstruct() {
        setLayout(new BorderLayout());
        
        currentRoundField = new JTextField();
        add(currentRoundField, BorderLayout.CENTER);
    }

    @Override
    public void gameStarted() {
        currentRoundField.setText("");
    }

    @Override
    public void newRound(int round, int maxRounds) {
        currentRoundField.setText("ROUND: " + round + "/" + maxRounds);
    }

}
